using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Rally_Dekstop
{
    public partial class frmTestResultEditor : Form
    {
        string[] recordtoreturn = null;
        public frmTestResultEditor()
        {
            InitializeComponent();

            this.Verdict_comboBox.Items.Add(string.Empty);
            int i = 0;
            for (i = 0; i < RallyDesk.CURRENTWORKSPACE.WorkSpaceSpecifics.TestResult.Verdicts.Count; i++)
            {
                this.Verdict_comboBox.Items.Add(RallyDesk.CURRENTWORKSPACE.WorkSpaceSpecifics.TestResult.Verdicts[i]);
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void DataEditor_Load(object sender, EventArgs e)
        {
           
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        public string[] editdata(string[] tc_result)
        { 
            tcid_textbox.Text = tc_result[0];
            description_textBox.Text = tc_result[1];
            Verdict_comboBox.Text = tc_result[2];
            Build_textBox.Text = tc_result[3];
            Notes_textBox.Text = tc_result[4];

            this.ShowDialog();
            return recordtoreturn;
     
        }

        private void OK_button_Click(object sender, EventArgs e)
        {
            if (recordtoreturn == null)
            recordtoreturn = new string[5];
            
            recordtoreturn[0] = tcid_textbox.Text;
            recordtoreturn[1] = description_textBox.Text;
            recordtoreturn[2] = Verdict_comboBox.Text;
            recordtoreturn[3] = Build_textBox.Text; 
            recordtoreturn[4] = Notes_textBox.Text; 
                       
            this.Close();
        }

        private void Cancel_button_Click(object sender, EventArgs e)
        {
            recordtoreturn = null;
            this.Close();
        }

        private void DataEditor_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void tcid_textbox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void description_textBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void Build_textBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void Verdict_comboBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void Notes_textBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void OK_button_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }

        private void Cancel_button_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Cancel_button.PerformClick();
            }
        }


    }
}